package com.atguigu.auth.controller;

import com.atguigu.auth.service.SysDeptService;
import com.atguigu.model.system.SysDept;
import com.atguigu.result.Result;
import com.atguigu.vo.system.SysDeptQueryVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * ClassName: SysDeptController
 * Package: com.atguigu.auth.controller
 * Description:
 *
 * @Author: 比特张
 * @Create: 2023/9/3 - 0:40
 * @Version: v1.0
 */
@Api(tags = "部门管理相关接口", value = "部门管理相关接口")
@Slf4j
@RestController
@RequestMapping("/admin/system/sysDept")
public class SysDeptController {
    @Resource
    private SysDeptService sysDeptService;

    @ApiOperation("部门分页、条件查询")
    @GetMapping("/{page}/{limit}")
    public Result pageQueryDept(@PathVariable Long page, @PathVariable Long limit,
                                SysDeptQueryVo sysDeptQueryVo) {
        IPage<SysDept> deptPage = sysDeptService.pageQueryDept(page, limit, sysDeptQueryVo);
        return Result.ok(deptPage);
    }

    @ApiOperation("查询所有部门信息")
    @GetMapping("/findAll")
    public Result findAll() {
        List<SysDept> list = sysDeptService.list();
        return Result.ok(list);
    }

    @ApiOperation("修改状态是否启用")
    @GetMapping("/updateStatus/{id}/{status}")
    public Result updateStatus(@PathVariable Long id, @PathVariable Long status) {
        return Result.ok();
    }

    @ApiOperation("修改部门信息")
    @PutMapping("/update")
    public Result update(@RequestBody SysDept sysDept) {
        return Result.ok();
    }

    @ApiOperation("根据部门Id删除")
    @DeleteMapping("/remove/{id}")
    public Result deleteById(@PathVariable Long id) {
        return Result.ok();
    }

    @ApiOperation("根据部门id获取部门信息")
    @GetMapping("/get/{id}")
    public Result getById(@PathVariable Long id) {
        return Result.ok();
    }

    @ApiOperation("新增部门")
    @PostMapping("/save")
    public Result save(@RequestBody SysDept sysDept) {
        return Result.ok();
    }
}
